Pluggable checking and inferencing of nonnull types for Java

نویسندگان

  • Torbjörn Ekman
  • Görel Hedin
چکیده

We have implemented a non-null type checker for Java and a new non-null inferencing algorithm for analyzing legacy code. The tools are modular extensions to the JastAdd extensible Java compiler, illustrating how pluggable type systems can be achieved. The resulting implementation is compact, less than 230 lines of code for the non-null checker and 460 for the inferencer. Non-null checking is a local analysis with little effect on compilation time. The inferencing algorithm is a whole-program analysis, yet it runs sufficiently fast for practical use, less than 10 seconds for 100.000 lines of code. We ran our inferencer on a large part of the JDK library, and could detect that around 70% of the dereferences, and around 24% of the method return values, were guaranteed to be non-null.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Java Bytecode Verification for @NonNull Types

Java’s annotation mechanism allows us to extend its type system with non-null types. However, checking such types cannot be done using the existing bytecode verification algorithm. We extend this algorithm to verify non-null types using a novel technique that identifies aliasing relationships between local variables and stack locations in the JVM. We formalise this for a subset of Java Bytecode...

متن کامل

Formalisation and implementation of an algorithm for bytecode verification of @NonNull types

Java’s annotation mechanism allows us to extend its type system with non-null types. Checking such types cannot be done using the existing bytecode verification algorithm. We extend this algorithm to verify non-null types using a novel technique that identifies aliasing relationships between local variables and stack locations in the JVM. We formalise this for a subset of Java Bytecode and repo...

متن کامل

Discretionary Object Confinement: A Minimalist Approach to Capabilities for the JVM

Secure cooperation is the problem of protecting mutually suspicious code units from one another. The notion of capabilities is an effective means for facilitating secure cooperation in dynamically extensible software systems, in which both trusted and untrusted code may run alongside each other. This paper proposes a lightweight, statically enforceable type system, Discretionary Object Confinem...

متن کامل

Checking Spring Annotations

Dependency injection frameworks such as the Spring framework rely on dynamic language features of Java. Errors arising from the improper usage of these features bypass the compile-time checks of the Java compiler. This paper discusses the application of static code analysis as a means to restore compile-time checking for Spring-related configuration errors. First, possible errors in the configu...

متن کامل

Practical, pluggable types for a dynamic language

Most languages fall into one of two camps: either they adopt a unique, static type system, or they abandon static type-checks for run-time checks. Pluggable types blur this division by (i) making static type systems optional, and (ii) supporting a choice of type systems for reasoning about different kinds of static properties. Dynamic languages can then benefit from static-checking without sacr...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:
  • Journal of Object Technology

دوره 6  شماره 

صفحات  -

تاریخ انتشار 2007